// src/api/cart.js
import axios from 'axios';

const API_URL = 'http://localhost:8000/api/carts/'; // 后端Django接口地址

// 获取购物车列表
export const getCarts = () => {
  return axios.get(API_URL);
};

// 添加商品到购物车
export const addCart = (data) => {
  return axios.post(API_URL, data);
};

// 更新购物车中的商品
export const updateCart = (id, data) => {
  return axios.put(`${API_URL}${id}/`, data);
};

// 从购物车中删除商品
export const deleteCart = (id) => {
  return axios.delete(`${API_URL}${id}/`);
};
